{% extends "base.html" %}

{% block title %}
        项目配置
{% endblock %}

{% block content %}

<style>
        .table th, .table td {vertical-align:middle;}
</style>

<script type="text/javascript">
        function do_reset(url){
               if (confirm("确定执行么？"))
               {
                       window.location.href=url;
               }
        }
</script>

<div class="alert alert-info">
	<h2>选择要配置的项目</h2>
</div>

<!--
<div style="float:right; width:80px; margin-bottom: 20px;">
	<button class="btn btn-block btn-primary" type="button" onclick="window.location.href='/project/add/'">添加</button>
</div>
-->

<div>
<p>
	<table class="table table-bordered table-striped table-hover">
	<tr>
	<th>项目代号</th>
	<th>项目别名</th>
	<th>项目路径</th>
	<th>项目所有者</th>
        <th>服务名称</th>
	<th>忽略更新</th>
	<th colspan=2>操作</th>
	</tr>
{% load key %}
{% for project in result %}
	<tr>
	<td>{{ project|key:'projectname' }}</td>
	<td>{{ project|key:'projectalias' }}</td>
	<td>{{ project|key:'codedir' }}</td>
	<td>{{ project|key:'codeowner' }}</td>
	<td>{{ project|key:'servicename' }}</td>
	<td>{{ project|key:'ignorelist' }}</td>
	<td><button class="btn btn-block" type="button" onclick="window.location.href='/project/edit/?project={{ project|key:'projectname' }}'">编辑</button></td>
	<td><button class="btn btn-block btn-danger" type="button" onclick="window.location.href='javascript:do_reset(\'/project/del/?project={{ project|key:'projectname' }}\')'">删除</button></td>
	</tr>

{% endfor %}
	<tr>
		<td colspan=6></td>
		<td colspan=2><button class="btn btn-block btn-primary" type="button" onclick="window.location.href='/project/add/'">添加项目</button></td>
	</tr>
	</table>
</p>
{% endblock %}
